<?=$system_message;?>

<div class="section-container auto" data-section data-options="deep_linking: true">
  <section class="active">
    <p class="title" data-section-title><a href="#create-login">Create Parent Login</a></p>
    <div class="content" data-slug="create-login" data-section-content>
    	<span class="clearfix"></span>
		<div class="panel">Create Parent Login</div>
		<form action="<?=site_url('user/parentlogin')?>" method="POST" autocomplete="off">
			<div class="panel">
			<div class="row">
				<div class="large-6 columns">
					<label>User Email</label>
					<?=form_error('parent_username');?>
					<input type="email" name="parent_username" placeholder="parentsemail@email.com" value="<?=set_value('parent_username');?>" required title="Parent Email">
				</div>
				<div class="large-6 columns">
					<label>Password</label>
					<?=form_error('parent_password');?>
					<input type="text" name="parent_password"  placeholder="parent's password" required title="Password for parent">
				</div>
			</div>
			<div class="row">
				<div class="large-6 columns">
					<label>Confirm Password</label>
					<?=form_error('parent_cpassword');?>
					<input type="text" name="parent_cpassword" placeholder="confirm parent's password" title="Confirm Password for parent">
				</div>
				<!-- <div class="large-6 columns">
					<label>Email <span class="iinfo">(Optional if you want to send username and password)</span></label>
					<?=form_error('parent_email');?>
					<input type="email" name="parent_email"  placeholder="parentsemail@email.com" title="Parent's Email">
				</div> -->
			</div>
			</div>
			<div class="panel">
			<div class="row">
				<div class="large-12 columns">
					<label>Search for student.</label>
					<input id="get_students" autocomplete="off" placeholder="To search student, enter student name or ID number." url="<?=site_url('output/get_students_for_parent_login');?>" type="text" title="Please use this fields to search for parent's children.">
				</div>
			</div>
			<div class="row">
				<div class="large-12 columns">
				<?=form_error('children[]');?>
				<table id="student-results" class="table table-bordered table-stripped">
					<tbody>
						<tr class="info">
							<td colspan="2">Please Search a Student.</td>
						</tr>
					</tbody>
				</table>
				</div>
			</div>
			</div>
			<hr class="clearfix">
			<input type="submit" value="Create Parent Login" name="create_parent_login" class="btn btn-primary">
		</form>
    </div>
  </section>


  <section>
    <p class="title" data-section-title><a href="#parent-login">Show All Parent Login</a></p>
    <div class="content" data-slug="parent-login" data-section-content>
          	<span class="clearfix"></span>
				<div class="panel">Show Login Accounts</div>
				
			<div class="row collapse">
				<div class="large-3 small-3 columns">
					<span class="prefix"><strong>Search Parent:</strong></span>
				</div>
				<form action="" method="POST">
				<div class="large-6 small-6 columns">
					<input id="student_enrollment_id" class="searchInput" required autocomplete="off" placeholder="To Search parent, Enter Student Name." url="<?=site_url('output/ajax_search_parent');?>" type="text" name="parent_search_data" autofocus>
				</div>
				<div class="large-3 small-3 columns">
					<input type="submit" name="search" class="button postfix" value="Search">
				</div>
				</form>
			</div>
				
				<table class="table table-bordered table-stripped">
					<tr class="info">
						<th colspan="2">Login Name</th>
						<th>Status</th>
						<th>Children</th>
					</tr>
					<?if($login):?>
						<?foreach ($login as $key => $value):?>
							<tr>
								<td style="width:100px;"><?=$value['login_name'];?></td>
								<td style="width:100px;">
									<div class="btn-group">
										<?if($value['status'] == 'active'):?>
											<a href="<?=site_url('user/auth/'.__link($value['login_id']));?>/disable" class="btn btn-mini btn-success">off</a>
										<?else:?>
											<a href="<?=site_url('user/auth/'.__link($value['login_id']));?>/enable" class="btn btn-mini">on</a>
										<?endif;?>
										<a href="<?=site_url('user/add_student_to_parent_login/'.__link($value['login_id']));?>" class="btn btn-mini confirm" title="Are you sure to add student to this parent login?" data-delete-container="tr" ><i class="icon-plus"></i></a>
										<a href="<?=site_url('user/edit_parent_login/'.__link($value['login_id']));?>" class="btn btn-mini confirm" title="Are you sure to edit this parent login?" data-delete-container="tr" ><i class="icon-lock"></i></a>
										<a href="<?=site_url('user/resend/'.__link($value['login_id']));?>" class="btn btn-mini" title="Are you sure you want to resend user login?" data-delete-container="tr"><i class="icon-share-alt"></i></a>
										<a href="<?=site_url('user/delete_login/'.__link($value['login_id']));?>" class="ajax-click btn btn-mini" data-delete-container="tr" title="Are you sure you want to delete user login?"><i class="icon-trash"></i></a>
									</div>
								</td>
								<td>
									<?if($value['status'] == 'active'):?>
										<span class="label label-success">Active</span>
									<?else:?>
										<span class="label">Inactive</span>
									<?endif;?>
								</td>
								<?if($value['children']):?>
								<td style="padding:2px;">
									<ul class="table-ul">
										<?foreach ($value['children'] as $c_key => $c_val):?>
											<li><a href="<?=site_url('user/delete_student_from_parent_login/'.__link($c_val->pc_id));?>" class="ajax-click" data-delete-container="li" title="Are you sure you want to delete student from parent login?"><i class="icon-remove icon-white"></i></a>&nbsp;&nbsp;<?=ucwords(strtolower($c_val->fullname));?></li>
										<?endforeach;?>
									</ul>
								</td>
								<?else:?>
									<td>
										<span style="margin:10px;">No Assigned Children</span>
									</td>	
								<?endif;?>
							</tr>
						<?endforeach;?>
					<?else:?>		
					<?endif;?>
				</table>
				<?=$links;?>
    </div>
  </section>
</div>


<script type="text/javascript" src="<?=script_url('custom/createlogin');?>"></script>
<script type="text/javascript" src="<?=script_url('custom/ajaxclick');?>"></script>
<script type="text/javascript" src="<?=script_url('custom/fsearch_2');?>"></script>